#### clear working environment ####
rm(list = ls())


#### load required packages ####
library(tidyverse)
library(PanelMatch)
library(countrycode)
library(stargazer)
library(Hmisc)
library(marginaleffects)
library(janitor)
library(kableExtra)
library(logr)


#### open the log file ####
log_open("democratic-transitions-replication.log")


#### run all R scripts (run in this order for complete replication) ###
source("R/argentina.R")
source("R/baseline-conflict-probabilities.R")
source("R/constraints.R")
source("R/constraints-placebo.R")
source("R/describe-transitions.R")
source("R/different-measures-pooled.R")
source("R/gender.R")
source("R/gender-placebo.R")
source("R/global-transitions.R")
source("R/mids.R")
source("R/parallel-trends.R")
source("R/polyarchy.R")
source("R/pooled-mids.R")
source("R/pooled-mids-era-subgroup.R")
source("R/pooled-mids-placebo.R")
source("R/suffrage.R")
source("R/suffrage-placebo.R")

source("R/identification-assumptions.R") # must be run after "parallel-trends.R" and "pooled-mids-placebo.R" (creates a combined figure) 


#### close log file ####
log_close()
